#pragma once

#include <QObject>
#include <QNetworkReply>

class QNetworkAccessManager;
namespace AliOSS
{
	class AliOSSAdapter;
	class AliOSSRemoveRequest : public QObject
	{
		Q_OBJECT
	private:
		AliOSSRemoveRequest(
			QObject *parent,
			QNetworkAccessManager *networkAccessManager,
			const QString &bucket,
			const QString &accessId);
	public:
		~AliOSSRemoveRequest();
	public:
		//! start remove action
		void doRemove();
		void setNeededInformation(
			const QString &datetimestr,
			const QString &signature);
	public:
		Q_SIGNAL void uploadFinished();
		Q_SIGNAL void uploadFailed();
		Q_SIGNAL void uploadError(QNetworkReply::NetworkError code);
		Q_SIGNAL void uploadProgress(qint64 bytesSent, qint64 bytesTotal);
	protected:
		void onRequestFinished();
	private:
		bool isOk();
	private:
		void prepare(const QString & path);
	private:
		friend class AliOSSAdapter;
		QNetworkAccessManager *networkAccessManager = nullptr;
		QString bucket;
		QString accessId;

		QString path;
		QString dtstr;
		QString signature;
		QNetworkReply *reply = nullptr;

	};

}